<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'db_conn.php';
$id=isset($_GET['id'])?$_GET['id']:-1;

if ($id==-1)
{
   header("location:news_index.php"); 
}
$sql="select a.*,b.typename from tb_news a,tb_newstype b where a.id=$id and a.typeid=b.id";   //写新闻查询语句  
$ab1s=$db->query($sql); //执行语句  $rs是一个结果集
$abc1=$ab1s->fetch_array(MYSQLI_BOTH); 



$nid=$id-1;
$sql="SELECT * FROM tb_news where id=$nid";
$ab3s=$db->query($sql); 
$abc3=$ab3s->fetch_array(MYSQLI_BOTH);

$nid=$id+1;
$sql="SELECT * FROM tb_news where id=$nid";
$ab2s=$db->query($sql); 
$abc2=$ab2s->fetch_array(MYSQLI_BOTH);




require 'news details.php';
$ab2s->free();
$db->close();